package com.etoak;

import com.etoak.filter.CrossFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication//在那个报下就扫描那个包
@MapperScan(basePackages = "com.etoak.car.mapper")
public class CarApp {

    public static void main(String[] args) {
        SpringApplication.run(CarApp.class,args);
    }

    @Bean
    public FilterRegistrationBean<CrossFilter> crossDomainFilter(){
        FilterRegistrationBean<CrossFilter> registrationBean = new FilterRegistrationBean<>();

        registrationBean.setFilter(new CrossFilter());

        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }

}
